package com.tryedhp.jetpackdemo.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.lifecycle.ViewModelProviders
import com.tryedhp.jetpackdemo.R
import com.tryedhp.jetpackdemo.model.WeatherViewModel
import kotlinx.android.synthetic.main.activity_view_mode.*

class ViewModeActivity : AppCompatActivity() {
    lateinit var weatherModel: WeatherViewModel
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_view_mode)
        weatherModel = ViewModelProviders.of(this)[WeatherViewModel::class.java]
        viewMode_text.text = weatherModel.textName
    }

    fun chang(view: View) {
        weatherModel.textName = "什么鬼 "
        viewMode_text.text = weatherModel.textName
    }
}
